import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:lx_widgets_library/lx_widgets_library.dart';

// 中心分页指示器
class CenterDotsIndicatorView extends StatelessWidget {
  // 分页数量
  final int dotsCount;
  // 当前分页索引
  final int currentIndex;

  const CenterDotsIndicatorView({
    super.key,
    required this.dotsCount,
    required this.currentIndex,
  });

  @override
  Widget build(BuildContext context) {
    return DotsIndicator(
      dotsCount: dotsCount,
      position: currentIndex.toDouble(),
      decorator: DotsDecorator(
        color: GrayColor.gray5, // 未选中点的颜色
        activeColor: LxCol.theme, // 选中点的颜色
        size: const Size.square(4.0),
        activeSize: const Size(16.0, 4.0),
        spacing: const EdgeInsets.symmetric(horizontal: 3.0),
        activeShape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(2.0),
        ),
      ),
    );
  }
}
